<%@ page import="java.sql.*, java.io.*" %>
<%
    String name =  request.getParameter("name");
    String email =  request.getParameter("email");
    String loginid =  request.getParameter("loginid");
    String password =  request.getParameter("password");
    String type =  request.getParameter("type");  
    
    try {
        Class.forName("oracle.jdbc.driver.OracleDriver");
        Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system", "sai");
        Statement st = con.createStatement();
        String insertquery = "insert into login values('"+loginid+"','"+name+"','"+password+"','"+email+"','"+type+"')";
        int x= st.executeUpdate(insertquery);
        out.println(name);
        out.println(email);
        out.println(loginid);
        /*String insertquery = "insert into login values(?,?,?,?,?)";
        PreparedStatement pstate = con.prepareStatement(insertquery);
        pstate.setString(1, loginid);
        pstate.setString(2, name);
        pstate.setString(3, password);
        pstate.setString(4, email);
        pstate.setString(5, type);*/       
        out.println(x);       
        RequestDispatcher rd = request.getRequestDispatcher("viewuser.jsp");
        rd.forward(request, response);
    } catch (Exception e) {       
    e.printStackTrace();
        RequestDispatcher rd = request.getRequestDispatcher("error.jsp");
        rd.forward(request, response);       
    }
%>